package parser;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author:石小俊
 * @Date: 2022/12/26 14:00
 * @Version:1.0-SNAPSHOT
 * @Description:
 */
public class ClassBean {

    private String no;
    private Map<String,StudentBean> students = new HashMap<>();

    // 如果属性中存在对象集合
    // 会添加两个普通方法
    // 1.将某一个对象添加到当前对象集合中
    public void addStudent(StudentBean student){
        students.put(student.getId(),student);
    }
    // 2.根据指定key查询指定Student对象的方法
    public StudentBean findStudent(String id){
        return students.get(id);
    }

    @Override
    public String toString() {
        return "ClassBean{" +
                "no='" + no + '\'' +
                ", students=" + students +
                '}';
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public Map<String, StudentBean> getStudents() {
        return students;
    }

    public void setStudents(Map<String, StudentBean> students) {
        this.students = students;
    }
}
